package com.study.forumsystemproject.service;

import com.study.forumsystemproject.common.MessageState;
import com.study.forumsystemproject.model.Message;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface IMessageService {

    void sendMessage(Message message);
    /**
     * Description: 获取到未读的信息数量
     * Param:  receiveUserId
     * return: 未读的信息数量
     * Author: xiaoxie
     * Date: 23:30 2024/8/19
     */
    Integer selectNotRedByReceiveUserId(Long receiveUserId);

    /**
     * Description: 根据接收者Id获得接收的信息列表
     * Param: * @param receiveUserId
     * return: java.util.List<com.study.forumsystemproject.model.Message>
     * Author: xiaoxie
     * Date: 18:28 2024/8/20
    */
    List<Message> selectRedByReceiveUserId(Long receiveUserId);

    /**
     * Description: 将帖子状态更改为已读
     * @param id,state
     * return: void
     * Author: xiaoxie
     * Date: 19:20 2024/8/20
    */
    void updateRedById(Long id, MessageState state);
    /**
     * Description: 根据Id获取帖子信息
     * Param: id
     * return: 帖子信息
     * Author: xiaoxie
     * Date: 19:23 2024/8/20
    */
    Message selectById(Long id);

    /**
     * Description: 提交回复信息,更新状态,插入回复信息
     * Param: * @param message
     * return: void
     * Author: xiaoxie
     * Date: 21:10 2024/8/20
    */
    @Transactional
    void reply(Message message);

}
